<?php
        class ApiCenter_VendorsApi_Helper_Data extends Mage_Core_Helper_Data
        {
       public  function loadWareHouseOption($vendorId){
            if(!$vendorId){
                return array();
            }
            $options = array();
            $collection =   Mage::getResourceModel("vendorswarehouse/address_collection");
    
            $collection->addFieldToFilter("main_table.vendor_id",$vendorId);
           
            $data =  $collection ->getData();
            foreach ($data as $k =>$v){
                $p['value'] = $v['sender_zip_code'];
                $p['label'] = $v['sender_name'];
                $options[] =  $p;
            }
            array_unshift($options, array('label' => '请选择仓库', 'value' => ''));
            return $options;
            }
            /**
             *  根据id加载商家信息
             *  @return VES_Vendors_Model_Vendor || BOOL
             * */
           public  function loadVendor($vendorId){
               $vendor = Mage::getModel("vendros/vendor")->load($vendorId);
               
               if(!$vendor->getId()){
                   return false;
               }else{
                   return $vendor;
               }
           }
        }
        
        
        
        